/* File:  DIRECTED_GRAPH_crance.hpp
 * Author:  Christopher Crance
 * Description:  Implementation of directed graph class
 */


template <class T, unsigned int N>
DIRECTED_GRAPH<T,N>::DIRECTED_GRAPH()
{
  COLLECTION<T>::m_size=N;
  m_vData = new T[N];  //allocate vertices array for N vertices
  for(int i = 0; i < N; i++)  //set all elements of vert array to default value for type T
    m_vData[i] = T();
  
  m_adjMatrix = new int*[N];  //allocate first dimension of adjacency matrix for N vertices
  for(int i = 0; i < N; i++)  //allocate second dimension of adj Matrix for N vertices
    m_adjMatrix[i] = new int[N];
  
  for(int i = 0; i < N; i++)  //set all elements of adjMatrix to 0 (no edges)
  {
    for(int j = 0; j < N; j++)
      m_adjMatrix[i][j] = 0;
  }
}


template <class T, unsigned int N>
void DIRECTED_GRAPH<T,N>::addEdge(const unsigned int i, const unsigned int j, const int w)
{
  if(i >= N || j >= N)
  {
    throw std::out_of_range("Out of range");
  }
  m_adjMatrix[i][j] = w;
}









